package com.cockatiel.statemachine.spring.statemachine.notify;

import com.cockatiel.statemachine.enums.ActivityState;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
 * Created By Intellij IDEA
 *
 * @Author: louxiujun@kanzhun.com
 * @Date: 2023-06-10 21:57:24
 * @Description:
 */
@WithStateMachine
@Data
@Slf4j
public class Notify {

    private String status = ActivityState.NOT_START.name();

    @OnTransition(target = "DATA_PREPARING")
    public void dataPreparingNotify() {
        log.info("enter state DATA_PREPARING");
        setStatus(ActivityState.DATA_PREPARING.name());
    }

    @OnTransition(target = "DATA_PREPARING")
    public void dataPreparingNotify2() {
        log.info("enter state DATA_PREPARING 2");
        setStatus(ActivityState.DATA_PREPARING.name());
    }

    @OnTransition(target = "DATA_PREPARED")
    public void dataPreparedNotify() {
        log.info("enter state DATA_PREPARED");
        setStatus(ActivityState.DATA_PREPARED.name());
    }

    @OnTransition(target = "DATA_PUSHING")
    public void dataPushNotify() {
        log.info("enter state DATA_PUSHING");
        setStatus(ActivityState.DATA_PUSHING.name());
    }

    @OnTransition(target = "FINISHED")
    public void finishedNotify() {
        log.info("enter state FINISHED");
        setStatus(ActivityState.FINISHED.name());
    }
}
